package main

func main() {

}

func shortestCompletingWord(licensePlate string, words []string) (res string) {
	m := make([]int, 26)
	num := 0
	for i := range licensePlate {
		if licensePlate[i] >= 'A' && licensePlate[i] <= 'Z' {
			m[licensePlate[i]-'A']++
			if m[licensePlate[i]-'A'] == 1 {
				num++
			}
		} else if licensePlate[i] >= 'a' && licensePlate[i] <= 'z' {
			m[licensePlate[i]-'a']++
			if m[licensePlate[i]-'a'] == 1 {
				num++
			}
		}
	}
	min := 1000000
	var tmp []int
	var tmpNum int
	for _, word := range words {
		tmpNum = 0
		tmp = make([]int, 26)
		for i := range word {
			tmp[word[i]-'a']++
			if m[word[i]-'a'] == tmp[word[i]-'a'] {
				tmpNum++
			}
		}
		if num == tmpNum && len(word) < min {
			min = len(word)
			res = word
		}
	}
	return
}
